<!DOCTYPE html>
<html>
<head>
<title>Set PreValue</title>
<meta charset="utf-8">
	
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}

div {
	width: 200px;
    padding: 10px 5px;
    display: inline-block;
    border: 1px solid #ccc;
    font-size: 16px;
	max-height: 35px;	
}

input[type=number] {
	width: 125px;
	padding: 10px 5px;
	display: inline-block;
	border: 1px solid #ccc;
	font-size: 16px; 
}

.button {
	padding: 10px 20px;
    width: 211px;
	font-size: 16px;	
}
</style>	
	
</head>

<script src="/jquery-3.5.1.min.js"></script>
<script>
  $ (document).ready(function() {
	$("#prevalue").load("/setPreValue.html");
  });
</script>

<script>
function setprevalue() {
	var inputVal = document.getElementById("myInput").value;
	inputVal = inputVal.replace(",", ".");
	_value = "<object data=" + "/setPreValue.html?value=" + inputVal + " ></object>";
	document.getElementById("result").innerHTML=_value;
//	location.reload();	
}
</script>

<body style="font-family: arial; padding: 0px 10px;">
<h3>Set the previous value for consistency check and substitution for NaN</h3>

<table style="width:100%">
  <tr>
    <h2>Current Value:</h2><p>
	<div id="prevalue"></div>
  </tr>	 
  <tr>
  <h2>Set Value:</h2><p>
    Input (Format = 123.456):<p>
	PreValue: 
	 <input type="number" id="myInput" name="myInput"
           pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
            title="This should be a number with up to 4 decimal places.">
	<p></p>
	<button class="button" type="button" onclick="setprevalue()">Set PreValue</button>
  </tr>	
  <tr>
    <h2>Result:</h2><p>
	<div id="result" readonly></div>
  </tr>	 

</table>

</body></html>